//
//  BENavigationController.m
//  s.
//
//  Created by pro on 2021/1/17.
//  Copyright © 2021 hailuo. All rights reserved.
//

#import "BENavigationController.h"

@interface BENavigationController ()

@end

@implementation BENavigationController

//- (UIStatusBarStyle)preferredStatusBarStyle
//{
//    if (@available(iOS 13.0, *)) {
//        return UIStatusBarStyleDarkContent;
//    } else {
//        return UIStatusBarStyleDefault;
//    }
//}
- (UIViewController *)childViewControllerForStatusBarStyle
{
    return self.topViewController;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    //让导航条的颜色也正常颜色相同；当translucent设置为YES时，导航栏呈现半透明效果
    self.navigationBar.translucent = NO;
    //去除导航栏底部横线
    self.navigationBar.backgroundColor = [UIColor clearColor];
    
    if (@available(iOS 15.0, *)) {
        self.navigationBar.standardAppearance.backgroundColor = KLColor(@"#FFFFFF");
        [self.navigationBar.standardAppearance configureWithOpaqueBackground];
        [self.navigationBar.standardAppearance setShadowImage:[UIImage imageWithColor:[UIColor clearColor] size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 0.5)]];
        [self.navigationBar.standardAppearance setTitleTextAttributes:@{NSForegroundColorAttributeName:KLColor(@"#333333"),
                                                   NSFontAttributeName:U_bfont(18)}];

        self.navigationBar.scrollEdgeAppearance = self.navigationBar.standardAppearance;
    } else {
        self.view.backgroundColor = UIColor.whiteColor;
        self.navigationBar.tintColor = jy_HexColor(@"#333333");
        self.navigationBar.barTintColor = UIColor.whiteColor;
        [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:
                                                         jy_HexColor(@"#333333"),
                                                     NSFontAttributeName:U_bfont(18)}];
        [[UINavigationBar appearance] setShadowImage:[UIImage imageWithColor:[UIColor clearColor] size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 0.5)]];
    }
}

#pragma mark - 重写方法
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    
    if (self.childViewControllers.count) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
 
}

- (UIViewController *)popViewControllerAnimated:(BOOL)animated
{

    return [super popViewControllerAnimated:animated];
}


@end
